#include<stdio.h>
#include<stdlib.h>
#include<time.h>

int main(int argc, char *argv[])
{
	int ran;
	int num;
	int i;

	srand(time(NULL));	
	ran = rand()%100;
	printf("%d\n", ran);
	for(i=1;i<=5;i++){
		printf("答案是100以内的数字，请输入你的猜想：");
		scanf("%d", &num);
	
		if(num==ran){
			printf("恭喜你猜对啦！\n");
			break;
		}else if(num>ran){
			printf("太大啦！你还有%d次机会！\n", 5-i);
		}else if(num<ran){
			printf("太小啦！你还有%d次机会！\n", 5-i);
		}
	}
	printf("游戏结束！\n");

	return 0;
}
